home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / signal.h < prev    next >
C/C++ Source or Header  |  1991-06-07  |  4KB  |  134 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)signal.h    7.3 (Berkeley) 5/14/88
  7.  * $Header: /sprite/src/lib/include/RCS/signal.h,v 1.11 91/05/30 13:22:03 shirriff Exp $
  8.  */
  9.  
  10. #ifndef _SIGNAL
  11. #define _SIGNAL
  12.  
  13. #include <cfuncproto.h>
  14.  
  15. #ifndef    NSIG
  16. #define NSIG    32
  17. #endif
  18.  
  19. #define    SIGHUP    1    /* hangup */
  20. #define    SIGINT    2    /* interrupt */
  21. #define    SIGQUIT    3    /* quit */
  22. #define    SIGILL    4    /* illegal instruction (not reset when caught) */
  23. #define    SIGTRAP    5    /* trace trap (not reset when caught) */
  24. #define    SIGIOT    6    /* IOT instruction */
  25. #define    SIGABRT    SIGIOT    /* compatibility */
  26. #define    SIGEMT    7    /* EMT instruction */
  27. #define    SIGFPE    8    /* floating point exception */
  28. #define    SIGKILL    9    /* kill (cannot be caught or ignored) */
  29. #define    SIGBUS    10    /* bus error */
  30. #define    SIGSEGV    11    /* segmentation violation */
  31. #define    SIGSYS    12    /* bad argument to system call */
  32. #define    SIGPIPE    13    /* write on a pipe with no one to read it */
  33. #define    SIGALRM    14    /* alarm clock */
  34. #define    SIGTERM    15    /* software termination signal from kill */
  35. #define    SIGURG    16    /* urgent condition on IO channel */
  36. #define    SIGSTOP    17    /* sendable stop signal not from tty */
  37. #define    SIGTSTP    18    /* stop signal from tty */
  38. #define    SIGCONT    19    /* continue a stopped process */
  39. #define    SIGCHLD    20    /* to parent on child stop or exit */
  40. #define    SIGCLD    SIGCHLD    /* compatibility */
  41. #define    SIGTTIN    21    /* to readers pgrp upon background tty read */
  42. #define    SIGTTOU    22    /* like TTIN for output if (tp->t_local<OSTOP) */
  43. #define    SIGIO    23    /* input/output possible signal */
  44. #define    SIGXCPU    24    /* exceeded CPU time limit */
  45. #define    SIGXFSZ    25    /* exceeded file size limit */
  46. #define    SIGVTALRM 26    /* virtual time alarm */
  47. #define    SIGPROF    27    /* profiling time alarm */
  48. #define SIGWINCH 28    /* window size changes */
  49. #define SIGUSR1 30    /* user defined signal 1 */
  50. #define SIGUSR2 31    /* user defined signal 2 */
  51.  
  52. /*
  53.  * Special Sprite signals:
  54.  */
  55.  
  56. #define SIGDEBUG 3    /* debug (same as quit in Sprite) */
  57. #define SIGMIG    10    /* migrate process */
  58. #define SIGMIGHOME 29    /* migrate process back to home node */
  59.  
  60. #ifndef KERNEL
  61. /* 
  62.  * This is taken more or less from K&R 2nd ed., section B9.  Recall 
  63.  * that signal() returns the previous handler.
  64.  */
  65. extern void (*signal _ARGS_((int sig,
  66.                  void (*handler)(int sig)))) _ARGS_((int sig));
  67.  
  68. extern int sigblock _ARGS_ ((int mask));
  69. extern int sigpause _ARGS_ ((int mask));
  70. extern int sigsetmask _ARGS_ ((int mask));
  71. #endif
  72.  
  73. /*
  74.  * Signal vector "template" used in sigvec call.
  75.  */
  76. struct    sigvec {
  77.     void    (*sv_handler)();    /* signal handler */
  78.     int    sv_mask;        /* signal mask to apply */
  79.     int    sv_flags;        /* see signal options below */
  80. };
  81. #define SV_ONSTACK    0x0001    /* take signal on signal stack */
  82. #define SV_INTERRUPT    0x0002    /* do not restart system on signal return */
  83. #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
  84.  
  85. /*
  86.  * Structure used in sigstack call.
  87.  */
  88. struct    sigstack {
  89.     char    *ss_sp;            /* signal stack pointer */
  90.     int    ss_onstack;        /* current status */
  91. };
  92.  
  93. #if 0
  94. /*
  95.  * This declaration has been moved to the machine dependent file
  96.  * machSignal.h
  97.  */
  98.  
  99. /*
  100.  * Information pushed on stack when a signal is delivered.
  101.  * This is used by the kernel to restore state following
  102.  * execution of the signal handler.  On some systems it is also made
  103.  * available to the handler to allow it to properly restore state if a
  104.  * non-standard exit is performed.  However, user programs should not
  105.  * rely on having access to this information.
  106.  */
  107. struct    sigcontext {
  108.     int    sc_onstack;        /* sigstack state to restore */
  109.     int    sc_mask;        /* signal mask to restore */
  110.     int    sc_sp;            /* sp to restore */
  111.     int    sc_fp;            /* fp to restore */
  112.     int    sc_ap;            /* ap to restore */
  113.     int    sc_pc;            /* pc to restore */
  114.     int    sc_ps;            /* psl to restore */
  115. };
  116. #endif
  117.  
  118. #define    BADSIG        (void (*)())-1
  119. #define    SIG_DFL        (void (*)())0
  120. #define    SIG_IGN        (void (*)())1
  121.  
  122. #ifdef KERNEL
  123. #define    SIG_CATCH    (void (*)())2
  124. #define    SIG_HOLD    (void (*)())3
  125. #endif
  126.  
  127. /*
  128.  * Macro for converting signal number to a mask suitable for
  129.  * sigblock().
  130.  */
  131. #define sigmask(m)    (1 << ((m)-1))
  132.  
  133. #endif /* _SIGNAL */
  134.